package system.service.impl;

import common.config.exception.CustomException;
import common.model.po.SysUser;
import org.springframework.stereotype.Service;
import system.model.converter.SysUserConverter;
import system.model.vo.UserInfo;
import system.service.SysUserService;
import system.service.SystemCommonService;

import javax.annotation.Resource;

/**
 * 描述
 *
 * @author 米泽鹏
 * @since 2023-11-1 下午 5:47
 */
@Service
public class SystemCommonServiceImpl implements SystemCommonService {

	@Resource
	private SysUserService userService;

	@Override
	public UserInfo getUserInfo(Long userId) {
		SysUser user = userService.getById(userId);
		if (user == null) {
			throw new CustomException("用户不存在");
		}
		return SysUserConverter.poToUserInfo(user);
	}

}
